<template>
  <div>
    这是总数{{showSum}}
    <el-button @click="add">加一</el-button>
    <el-button @click="addM">加一Mutation</el-button>
    <el-button @click="addMN">加N</el-button>
    <el-button @click="addMNN">加NN</el-button>
    <el-button @click="addtime">延迟加</el-button>

  </div>
</template>
<script>
export default {
  data () {
    return {
    }
  },
  mounted () {

  },
  computed: {
    showSum () {
      return this.$store.state.sum
    }
  },
  methods: {
    add () {
      this.$store.state.sum += 1
    },
    addM () {
      this.$store.commit('addM')
    },
    addMN () {
      this.$store.commit('addMN', 4)
    },
    addMNN () {
      this.$store.commit('addMNN', 2, 3)
    },
    addtime () {
      this.$store.dispatch('timeAdd', 8)
    }
  }
}
</script>

<style scoped>
#container {
  padding: 0px;
  margin: 0px;
  width: 100%;
  height: 800px;
}
</style>
